package com.woniu.order.client;

import com.woniu.order.client.param.SearchOrderParam;
import com.woniu.order.client.result.OrderQueryResultInfo;
import com.woniu.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * name是项目名，contextId是client的名字
 */
@FeignClient(contextId = "orderQueryClient", name = "order")
public interface OrderQueryClient {

    /**
     * 根据订单ID查询订单
     *
     * @param oderId
     * @return
     */
    @GetMapping("searchOrderByOrderId")
    public Result<OrderQueryResultInfo> searchOrderByOrderId(@RequestParam("oderId") Integer oderId);


    /**
     * 根据用户ID、订单状态查询订单
     *
     * @param searchOrderParam
     * @return
     */
    @PostMapping("searchOrder")
    public Result<List<OrderQueryResultInfo>> searchOrder(@RequestBody SearchOrderParam searchOrderParam);

}
